<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<ul class="layui-nav layui-bg-blue" style="background-color: #eeeeee !important;">
    <a href="${pageContext.request.contextPath}/api/v1/pub/user/json/index" style="color: #000000;"><img
            style="margin-top: 10px"
            src="https://oos.icanci.cn/app/static/webapps/ladybird-web-static/user/img/ladybird.png"></a>
    <li class="layui-nav-item">
        <a href="${pageContext.request.contextPath}/api/v1/pub/user/json/index" style="color: #000000;">位置：苏州</a>
    </li>
    <li class="layui-nav-item">
        <a href="${pageContext.request.contextPath}/api/v1/pub/user/json/index" style="color: #000000;">首页</a>
    </li>
    <li class="layui-nav-item" lay-unselect="" style="float: right;">
        <c:if test="${user_id == null}">
            <a href="javascript:;" style="color: #000000;">未登录</a>
            <dl class="layui-nav-child">
                <dd><a href="${pageContext.request.contextPath}/api/v1/pri/user/do/login-by-account">登录</a></dd>
                <dd><a href="${pageContext.request.contextPath}/api/v1/pri/user/do/register">注册</a></dd>
            </dl>
        </c:if>
        <c:if test="${user_id  != null}">
            <a href="javascript:;" style="color: #000000;"><img
                    src="${user_head_img}"
                    class="layui-nav-img">我</a>
            <dl class="layui-nav-child">
                <dd><a href="${pageContext.request.contextPath}/api/v1/pri/user/order">个人中心</a></dd>
                <dd><a href="${pageContext.request.contextPath}/api/v1/pri/user/do/logout">退出</a></dd>
            </dl>
        </c:if>
    </li>
    <div class="layui-input-inline">
        <input type="search" id="search" name="search"
               style="width: 400px;margin-left: 15px;display: inline-block;background-color: #eeeeee;border: 0px"
               lay-verify="search" placeholder="搜索明星、演出、演唱会" autocomplete="off" class="layui-input">
        <button type="button" id="es" name="btnSubmit" onclick="entersearch()" style="position: absolute;"
                class="layui-btn layui-btn-normal">搜索
        </button>
    </div>
</ul>
<script src="https://oos.icanci.cn/app/static/webapps/ladybird-web-static/user/js/jquery-2.2.3.min.js"></script>
<script>
    function entersearch() {
        let value = document.getElementById("search").value;
        console.log(typeof value)
        if (typeof value == "undefined" || value == null || value.trim == "" || value == "") {
        } else {
            // 发送数据到 search 请求
            window.location = "${pageContext.request.contextPath}/api/v1/pub/user/json/search?search=" + value
        }
    }

    $('#search').bind('keypress', function (event) {
        if (event.keyCode == "13") {
            event.preventDefault();
            //回车执行查询
            $('#es').click();
        }
    });
</script>
